<?php include("/includes/header.php") ?>

<div style="height: 100vh">
	<div id="login" class="display-table">
		<div>
			<div id="form-login-placer">
				<form class="form-horizontal">
					<fieldset>
						<div class="form-header">
							<h3><i class="fa fa-user"></i> Login</h3>
						</div>
						<div class="control-group">
							<label class="control-label" for="username">Username</label>
							<div class="controls">
								<input type="text" class="input-xlarge" id="username">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="password">Password</label>
							<div class="controls">
								<input type="password" class="input-xlarge" id="password">
							</div>
						</div>
						<div class="form-actions">
							<button type="submit" class="btn btn-primary btn-login">Login</button>
							<!-- <button class="btn">Batal</button> -->
							<a href="#">Forgot password?</a>
						</div>
					</fieldset>
				</form>
			</div>
		</div>
	</div>
</div>

<div class="footer">
</div>

<?php include("/includes/footer.php") ?>  

<SCRIPT TYPE="text/javascript">
	$(document).ready(function() {
		$('#username').focus();
		$('.btn-login').click(function(event) {
			event.preventDefault();
			var formLogin = {
				username: $('#username').val(),
				password: $('#password').val(),
				act: 1
			}
			$.ajax({
				url: '/action/act_login.php',
				type: 'POST',
				data: formLogin,
				cache: false, 
				success: function(data){
					if (data == "sukses") {
						window.location = "index.php";
					} else {
						alert("Gagal melakukan login");
					}
				}
			})
		});
	});
</SCRIPT>
